// dropdown.js
Component({
  properties: {
    options: {
      type: Array,
      value: []
    }
  },
  data: {
    isOpen: false,
    selectedValue: ''
  },
  methods: {
    toggleDropdown() {
      this.setData({
        isOpen: !this.data.isOpen
      });
    },
    selectOption(event) {
      const value = event.currentTarget.dataset.value;
      this.setData({
        selectedValue: value,
        isOpen: false
      });
      this.triggerEvent('select', value); // 触发自定义事件，将选中的值传递给父组件
    }
  }
});
